/*---------------------------------------------------------------------
 * File name: ZJY096S0700BG01.h
 *
 * Copyright (c) <2020-2022>, <ChenLong>
 *
 * All rights reserved.
 *
 * Author: ChenLong
 * Email: worldlong@foxmail.com
 *--------------------------------------------------------------------*/
#pragma once

#include "hal_gpio.h"
#include "hal_spi.h"
#include "hal_timer.h"
#include "display.h"
/*
*/
class ZJY096S0700BG01 : public DisplayDev
{
public:
  ZJY096S0700BG01(HAL_Timer &timer, HAL_SPI &spi, HAL_GPIO &cs, HAL_GPIO &dc, HAL_GPIO &reset) :
    _timer(timer),
    _spi(spi),
    _cs(cs),
    _dc(dc),
    _reset(reset)
    {}
    
    void init();
    void clear();
    void set_pos(int x0, int x1, int y0, int y1);
    void print(print_info_t &info);
    void reset();
    void display_on() {write_cmd(0xaf);}
    void display_off() {write_cmd(0xae);}
  
private:
  HAL_Timer &_timer;
  HAL_SPI &_spi;
  HAL_GPIO &_cs;
  HAL_GPIO &_dc;
  HAL_GPIO &_reset;
  
  void write_cmd(uint8_t cmd);
  void write_data(uint8_t data);
};


